#ifndef __WF_AUDIO_PLAYER_HXX__
#define __WF_AUDIO_PLAYER_HXX__

/**
 * to invalidate the winsock.h in windows.h file
 */
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <mmsystem.h>

#include "audioplayer.hxx"

class EXPORT WFAudioPlayer	:	public AudioPlayer
{
public:
	//\brief Constructor
	WFAudioPlayer(tUInt32 bits_sample,tUInt32 sample_sec,tUInt32 block_nb,tUInt32 block_size,tUInt32 channel_nb,FileLog* filelog = NULL);

	//\brief Descontructor
	virtual ~WFAudioPlayer();

	virtual tInt32 Init();
	virtual tInt32 UnInit();

	/**
	 * Write voice data into player, as writed, it plays
	 */
	virtual tInt32 WriteAudio(tByte* data, tUInt32 size);

	virtual tInt32 SetCurrentPos(void);

	virtual void ResetCurrentPos(void);

	virtual tByte* GetLatestData(tInt32 size);

protected:
	
	virtual void ResetPlayer(void);

	// CallBack function of player
	virtual tByte* AllocateBlocks(tUInt32 count, tUInt32 size);

	virtual void FreeBlocks(void);

private:

	static void __stdcall WaveOutProc(HWAVEOUT hWaveOut,UINT uMsg,DWORD dwInstance,DWORD dwParam1,DWORD dwParam2);

	HWAVEOUT _hwaveout;
	WAVEHDR* _blocks;

	tByte*	_pbuf;
	tUInt32	_buf_size;

	tUInt32 _all_played_nb;
};

#endif // __WF_AUDIO_PLAYER_HXX__